#ifndef Channel_INCLUDED
#define Channel_INCLUDED

#include "loggerpriority.h"
#include <string>
using std::string;

enum Channel_Type
{
    Channel_Type_Console,
    Channel_Type_File
};

struct LogMsg
{
    char*           m_msg;
    LogPriority     m_prio;
    string          m_file;
    int             m_line;
    int             m_tid;  // thread tid
    LogMsg():m_msg(NULL),m_prio(LOG_INFO),m_line(-1),m_tid(0)
    {}

    ~LogMsg()
    {
        if (m_msg != NULL)
        {
            delete [] m_msg;
            m_msg = NULL;
        }
    }

    LogMsg(char* msg,LogPriority prio,const char *file,int line,int tid):
    m_msg(msg),m_prio(prio),m_file(file),m_line(line),m_tid(tid)
    {}
};

class Channel
{
public:
    Channel()
    {}

    virtual void open()
    {}

    virtual void close()
    {}

    virtual Channel_Type type() = 0;

    virtual void log(const LogMsg& msg) = 0;

    virtual ~Channel()
    {}
    
private:
    Channel(const Channel&);
    Channel& operator = (const Channel&);
};


#endif



